package fr.babos.graphic.controls 
{
	import flash.display.MovieClip;
	import fr.babos.core.utils.DisplayObjectUtils;
	/**
	 * @author ZoulouX
	 */
	public class MovieClipButton extends GenericButton 
	{
		public static const ROLL_OVER_LABEL				:String 		= "rollOver";
		public static const ROLL_OUT_LABEL				:String 		= "rollOut";
		public static const MOUSE_DOWN_LABEL			:String			= "mouseDown";
		public static const MOUSE_UP_LABEL				:String 		= "mouseUp";
		public static const MOUSE_UP_OUTSIDE_LABEL		:String 		= "mouseUpOutside";
		
		public var movieClip						:MovieClip;
		
		public function MovieClipButton ()
		{
			
		}
		
		override protected function doOver ():void
		{
			if (movieClip != null)
			{
				DisplayObjectUtils.checkAndPlay(movieClip, ROLL_OVER_LABEL);
			}
		}
		
		override protected function doOut ():void
		{
			if (movieClip != null)
			{
				DisplayObjectUtils.checkAndPlay(movieClip, ROLL_OUT_LABEL);
			}
		}
		
		override protected function doDown ():void
		{
			if (movieClip != null)
			{
				DisplayObjectUtils.checkAndPlay(movieClip, MOUSE_DOWN_LABEL);
			}
		}
		
		override protected function doUp ():void
		{
			if (movieClip != null)
			{
				DisplayObjectUtils.checkAndPlay(movieClip, MOUSE_UP_LABEL);
			}
		}
		
		override protected function doUpOutside ():void
		{
			if (movieClip != null)
			{
				DisplayObjectUtils.checkAndPlay(movieClip, MOUSE_UP_OUTSIDE_LABEL);
			}
		}
	}
}